package exercise1;

public class MyFuckingThread implements Runnable {
	private Object lock;

	public MyFuckingThread(Object lock) {
		this.lock = lock;
	}

	@Override
	public void run() {
		while (true) {
			synchronized (lock) {
				System.out.println(Thread.currentThread().getId());
				try {
					Thread.currentThread().sleep(300);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
			}

		}

	}

	public static void main(String[] args) {
		Object lock = new Object();
		for (int b = 0; b < 7; b++) {
			new Thread(new MyFuckingThread(lock)).start();
		}
	}

}
